package kr.hkit.androidcomplete03.ch20;

import kr.hkit.androidcomplete03.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Ch20_Main extends ListActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.ch20, android.R.layout.simple_list_item_1);
		setListAdapter(adapter);
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		
		
		Intent intent = null;
		switch(position){
		case 0: intent = new Intent(this, FragmentTest.class);
		break;
		case 1: intent = new Intent(this, FragmentReuse.class);
		break;
		case 2: intent = new Intent(this, TwoFragment.class);
		break;
		case 3: intent = new Intent(this, FragmentManagerTest.class);
		break;
		case 4: intent = new Intent(this, FragmentArgument.class);
		break;
		case 5: intent = new Intent(this, FragmentBackStack.class);
		break;
		case 6: intent = new Intent(this, ListFragmentTest.class);
			break;
		case 7: intent = new Intent(this, ListFragmentDivideTest.class);
			break;
		case 8: intent = new Intent(this, MultiPaneWidth.class);
			break;
		case 9: intent = new Intent(this, MultiPaneWidthOri.class);
			break;
		}
		startActivity(intent);
	}
}
